package com.danjinwulian.device.service.impl;

import java.util.List;

import com.danjinwulian.common.core.domain.entity.IotHotel;
import com.danjinwulian.common.utils.DateUtils;
import com.danjinwulian.device.mapper.IotHotelMapper;
import com.danjinwulian.device.service.IIotHotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 酒店公寓Service业务层处理
 * 
 * @author ken.h
 * @date 2022-08-23
 */
@Service
public class IotHotelServiceImpl implements IIotHotelService
{
    @Autowired
    private IotHotelMapper iotHotelMapper;

    /**
     * 查询酒店公寓
     * 
     * @param hotelId 酒店公寓主键
     * @return 酒店公寓
     */
    @Override
    public IotHotel selectIotHotelByHotelId(Long hotelId)
    {
        return iotHotelMapper.selectIotHotelByHotelId(hotelId);
    }

    /**
     * 查询酒店公寓
     *
     * @param hotelPhone 酒店公寓店长账号
     * @return 酒店公寓
     */
    @Override
    public IotHotel selectIotHotelByHotelPhone(String hotelPhone)
    {
        return iotHotelMapper.selectIotHotelByHotelPhone(hotelPhone);
    }

    /**
     * 查询酒店公寓列表
     * 
     * @param iotHotel 酒店公寓
     * @return 酒店公寓
     */
    @Override
    public List<IotHotel> selectIotHotelList(IotHotel iotHotel)
    {
        return iotHotelMapper.selectIotHotelList(iotHotel);
    }

    @Override
    public int selectIotHotelCount() {
        return iotHotelMapper.selectIotHotelCount();
    }

    /**
     * 新增酒店公寓
     * 
     * @param iotHotel 酒店公寓
     * @return 结果
     */
    @Override
    public int insertIotHotel(IotHotel iotHotel)
    {
        iotHotel.setCreateTime(DateUtils.getNowDate());
        return iotHotelMapper.insertIotHotel(iotHotel);
    }

    /**
     * 修改酒店公寓
     * 
     * @param iotHotel 酒店公寓
     * @return 结果
     */
    @Override
    public int updateIotHotel(IotHotel iotHotel)
    {
        iotHotel.setUpdateTime(DateUtils.getNowDate());
        return iotHotelMapper.updateIotHotel(iotHotel);
    }

    /**
     * 批量删除酒店公寓
     * 
     * @param hotelIds 需要删除的酒店公寓主键
     * @return 结果
     */
    @Override
    public int deleteIotHotelByHotelIds(Long[] hotelIds)
    {
        return iotHotelMapper.deleteIotHotelByHotelIds(hotelIds);
    }

    /**
     * 删除酒店公寓信息
     * 
     * @param hotelId 酒店公寓主键
     * @return 结果
     */
    @Override
    public int deleteIotHotelByHotelId(Long hotelId)
    {
        return iotHotelMapper.deleteIotHotelByHotelId(hotelId);
    }
}
